package study.zhangxh.annotations.validate;

import study.zhangxh.annotations.UseCase;

import java.util.List;

/**
 * 说明
 *
 * @author: zhangxh
 * @email: zhangxh@cheegu.com
 * @date: 2018/6/14 21:49
 */
public class PassWordUtils extends Utils{
    @UseCase(id = 1,description = "验证密码")
    public boolean validatePassword(String password) {
        return  password.matches("\\w*\\d\\W*");
    }
    @UseCase(id = 2,description = "验证密码1")
    public String encryptPassword(String password) {
        return new StringBuilder(password).reverse().toString();
    }
    @UseCase(id = 2)
    public boolean checkForNewPassword( List<String> prevPasswords,String password) {
        return !prevPasswords.contains(password);
    }
}
